#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int maxn=1e6+5,INF=1e9;
int n,q;
struct intv{int l,r,id;};
int w(intv A){return A.r-A.l+1;}
bool operator <(intv A,intv B){return (A.r-A.l+1)>(B.r-B.l+1);}
priority_queue<intv> L[maxn],R[maxn];
int vL[maxn],vR[maxn],ex[maxn],cnt=0,N=1e6,cl[maxn],cr[maxn];
unordered_map<int,int> mp;
#define ls (k<<1)
#define rs (k<<1|1)
#define mid ((l+r)>>1)
int mnL[maxn],mnR[maxn],res[maxn];
struct node{
	int mnL,mnR,res;
}xds[maxn<<2];
node merge(node A,node B){return {max(A.mnL,B.mnL),min(A.mnR,B.mnR),min({A.res,B.res,B.mnR-A.mnL})};}
void pushup(int k){xds[k]=merge(xds[ls],xds[rs]);}
void build(int k,int l,int r){
	if(l==r)return xds[k].mnL=vL[l],xds[k].mnR=vR[l],xds[k].res=INF,void();
	build(ls,l,mid);build(rs,mid+1,r);
	pushup(k);
}
void modify(int k,int l,int r,int x){
	if(l==r){
		xds[k].mnL=vL[l],xds[k].mnR=vR[l],xds[k].res=INF;
		if(vL[l]>l||vR[l]<l){
			cout<<vL[l]<<" "<<vR[l]<<" "<<l<<endl;
			exit(0);
		}
//		assert(vL[l]<=l),assert(vR[l]>=l);
//		cerr<<l<<" : "<<xds[k].mnL<<" "<<xds[k].mnR<<endl;
		return void();
	}
	if(x<=mid)modify(ls,l,mid,x);
	else modify(rs,mid+1,r,x);
	pushup(k);
}
int cntL[maxn],cntR[maxn];
priority_queue<int> qL;
priority_queue<int,vector<int>,greater<int> > qR;
/*
5
A 1 5
A 2 7
A 4 6
A 6 8
R 4 6
4
6
5
4
7
*/
signed main(){
	freopen("stone.in","r",stdin);
	freopen("stone.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);n=N;
	cin>>q;for(int i=1;i<=n;i++)vL[i]=-INF,vR[i]=INF;build(1,1,n);
	for(int i=1;i<=q;i++){
		char c;int l,r;cin>>c>>l>>r;r--;
//		cerr<<c<<" "<<l<<" "<<r<<endl;
		if(c=='A'){
			++cnt;R[l].push({l,r,cnt});L[r].push({l,r,cnt});
			mp[l*N+r]=cnt;vR[l]=min(vR[l],r);vL[r]=max(vL[r],l);
			modify(1,1,n,l);modify(1,1,n,r);
			cntL[l]++,cntR[r]++;qL.push(l),qR.push(r);
			cl[cnt]=l,cr[cnt]=r;
		}else{
			int p=mp[l*N+r];ex[p]=1;
//			cerr<<"del "<<p<<" "<<R[l].top().id<<endl;
			cntL[l]--,cntR[r]--;
			while(L[r].size()&&ex[L[r].top().id]==1)L[r].pop();
			while(R[l].size()&&ex[R[l].top().id]==1)R[l].pop();
			vR[l]=(R[l].empty()?INF:R[l].top().r);
			vL[r]=(L[r].empty()?-INF:L[r].top().l);
			modify(1,1,n,l);modify(1,1,n,r);
		}
//		for(int j=1;j<=n;j++)cerr<<vL[j]<<" ";cerr<<endl;
//		for(int j=1;j<=n;j++)cerr<<vR[j]<<" ";cerr<<endl;
		while(qL.size()&&cntL[qL.top()]==0)qL.pop();
		while(qR.size()&&cntR[qR.top()]==0)qR.pop();
		int ans=xds[1].res+1;
		int mxL=qL.top(),mnR=qR.top();
		if(mnR>=mxL)ans=vR[mxL]-mxL+1+mnR-vL[mnR]+1-(mnR-mxL+1);
		cout<<ans<<endl;
//		if(ans<0){
//			exit(0);
//		}
	}
	return 0;
}

